package com.dq.controller.api.staff;

import com.dq.exception.customException.AdminException;
import com.dq.controller.in.TrackRecordQuery;
import com.dq.controller.in.TrackRecordRequest;
import com.dq.vo.Vo;
import com.dq.service.AllService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
 * @Author luchangtong
 * @Date 2020/3/18 11:21
 */
@Api(description = "跟踪记录")
@RestController
@RequestMapping("/staff/trackRecord")
public class ApiTrackRecordController  extends AllService {

    @ApiOperation("跟踪列表")
    @PostMapping("list")
    public Vo list(@RequestBody TrackRecordQuery trackRecordQuery) throws AdminException{
        return trackRecordService.list(trackRecordQuery);
    }

    @ApiOperation("添加跟踪")
    @PostMapping("save")
    public Vo save(@RequestBody TrackRecordRequest trackRecordRequest)throws AdminException{
        return trackRecordService.save(trackRecordRequest);
    }

    @ApiOperation("编辑跟踪")
    @PostMapping("edit/{id}")
    public Vo edit(@RequestBody TrackRecordRequest trackRecordRequest,@PathVariable Long id) throws AdminException{
        return trackRecordService.edit(trackRecordRequest,id);
    }

    @ApiOperation("删除跟踪")
    @PostMapping("delete/{id}")
    public Vo delete(@PathVariable Long id) throws AdminException {
        return trackRecordService.delete(id);
    }
}
